package com.twu.biblioteca.models;

import java.util.List;

public class LibraryBook {
    private String isbn;
    private String bookName;
    private List<Author> authors;
    private boolean isAvailable;
    private boolean isReserved;

    public LibraryBook(String isbnCode, String bookName, List<Author> authors, boolean isAvailable, boolean isReserved) {
        this.isbn = isbnCode;
        this.bookName = bookName;
        this.authors = authors;
        this.isAvailable = isAvailable;
        this.isReserved = isReserved;
    }

    public String getIsbn() {
        return isbn;
    }

    public String getBookName() {
        return bookName;
    }

    public List<Author> getAuthors() {
        return authors;
    }

    public boolean isAvailable() {
        return isAvailable;
    }

    public boolean isReserved() {
        return isReserved;
    }

    private void setIsReserved(boolean isReserved) {
        this.isReserved = isReserved;
    }

    public String reserveBook() {
        if(!isReserved()) {
            setIsReserved(true);
            return "Thank You! Enjoy the book..!";
        }
        return "Sorry! Book already reserved..!";
    }

    public String notifyAvailability() {
        if(isAvailable()) {
            return "Book Available !";
        }
        return "Sorry! Book UnAvailable!";
    }
}
